import 'package:flutter/material.dart';


import '../pages/guide_page.dart';

import '../pages/index_page.dart';

import '../pages/login/login_page.dart';
import '../pages/login/register_page.dart';
import '../pages/mian/view.dart';
import '../test.dart';



final Map<String,Function> routes={
  '/':(context)=> const MainPage(),
  '/login':(context)=>const LoginPage(),
  '/register':(context)=>const RegisterPage(),
  '/index':(context)=>const IndexPage(),
};

Route routeGenerator(RouteSettings settings) {
  final String? name = settings.name;
  final Function? pageBuilder = routes[name];
  if (pageBuilder != null) {
    if (settings.arguments != null) {
      return MaterialPageRoute(builder: (context) => pageBuilder(context, arguments: settings.arguments));
    } else {
      return MaterialPageRoute(builder: (context) => pageBuilder(context));
    }
  }
  return MaterialPageRoute(builder: (context) =>  const LoginPage());
}


